<?php

namespace app\adminapi\controller\v1\portal;

use app\adminapi\controller\AuthController;
use app\services\portal\PortalSchoolHelpService;
use think\facade\App;

/**
 * 学习帮助
 */
class PortalSchoolHelp extends AuthController
{
    public function __construct(App $app,PortalSchoolHelpService $service)
    {
        parent::__construct($app);
        $this -> services =  $service;
    }

    public function index(){
        $where = $this->request->postMore([
            ['website_id',$this  -> website],
        ]);
        return app() -> make('json') -> successful($this -> services -> index($where));
    }

    public function createOrUpdate(){
        $where = $this->request->postMore([
            ['website_id',$this  -> website],
            ['id',0],
            ['title',''],
            ['publisher',''],
            ['content',''],
        ]);
        return app() -> make('json') -> successful($this -> services -> update($where));
    }

}